﻿<UserControl x:Class="LongBar.Tile"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     Height="100" MouseLeftButtonDown="TileContentGrid_MouseLeftButtonDown">
    <UserControl.ContextMenu>
        <ContextMenu Name="TileMenu" Opened="TileMenu_Opened">
            <MenuItem Name="PinItem" Header="{DynamicResource Pin}" IsCheckable="True" Checked="PinItem_Checked" Unchecked="PinItem_Unchecked"/>
            <MenuItem Name="MinimizedItem" Header="{DynamicResource Minimized}" IsCheckable="True" Checked="MinimizedItem_Checked"  Unchecked="MinimizedItem_Unchecked"/>
            <MenuItem Name="MoveUpItem" Header="{DynamicResource MoveUp}" IsEnabled="False" Click="MoveUpItem_Click"/>
            <MenuItem Name="MoveDownItem" Header="{DynamicResource MoveDown}" IsEnabled="False" Click="MoveDownItem_Click"/>
            <MenuItem Name="RemoveItem" Header="{DynamicResource Remove}" Click="RemoveItem_Click" />
            <MenuItem Name="CustomizeItem" Header="{DynamicResource Properties}" Click="CustomizeItem_Click"/>
        </ContextMenu>
    </UserControl.ContextMenu>
    <UserControl.Resources>
        <DoubleAnimation x:Key="LoadHeightAnim" Storyboard.TargetProperty="Height" From="0" AccelerationRatio="0.3" Duration="0:0:0.4" Completed="LoadHeightAnim_Completed"/>
        <DoubleAnimation x:Key="LoadOpacityAnim" Storyboard.TargetName="TileContentGrid" Storyboard.TargetProperty="Opacity" To="1" BeginTime="0:0:0.4" Duration="0:0:0.7" Completed="LoadOpacityAnim_Completed"/>
        <DoubleAnimation x:Key="UnLoadHeightAnim" Storyboard.TargetProperty="Height" To="0" BeginTime="0:0:0.1" AccelerationRatio="0.3" Duration="0:0:0.5" Completed="UnLoadHeightAnim_Completed"/>
        <DoubleAnimation x:Key="MinimizeAnim" Storyboard.TargetProperty="Height"  BeginTime="0:0:0.1" AccelerationRatio="0.3" Duration="0:0:0.5" Completed="MinimizeAnim_Completed"/>
        <DoubleAnimation x:Key="UnMinimizeAnim" Storyboard.TargetProperty="Height"  BeginTime="0:0:0.1" AccelerationRatio="0.3" Duration="0:0:0.5" Completed="UnMinimizeAnim_Completed"/>
    </UserControl.Resources>

    <DockPanel Style="{DynamicResource TilePanel}" MouseLeftButtonDown="TileContentGrid_MouseLeftButtonDown">
        <DockPanel Name="Header" Style="{DynamicResource TileHeader}" MouseLeftButtonDown="DockPanel_MouseLeftButtonDown">
            <Image Name="TitleIcon" Style="{DynamicResource TileIcon}"/>
            <TextBlock Name="TitleTextBlock" Style="{DynamicResource TileTitle}"/>
        </DockPanel>
        <StackPanel Name="Splitter" Style="{DynamicResource TileSplitterPanel}" MouseLeftButtonDown="Splitter_MouseLeftButtonDown"  MouseLeftButtonUp="Splitter_MouseLeftButtonUp" MouseMove="Splitter_MouseMove">
            <Line Name="SplitterLine1" Style="{DynamicResource TileSplitterLine1}"/>
            <Line Name="SplitterLine2" Style="{DynamicResource TileSplitterLine2}"/>
        </StackPanel>
        <Grid Name="TileContentGrid" Opacity="0" Style="{DynamicResource TileContent}" MouseLeftButtonDown="TileContentGrid_MouseLeftButtonDown" MouseMove="UserControl_MouseMove"/>
    </DockPanel>
</UserControl>
